﻿Array.prototype.find = function (searchStr) {
    for (var i = 0; i < this.length; i++) {
        if (typeof (searchStr) == 'function') {
            if (searchStr(this[i])) {
                if (!returnArray) { returnArray = [] }
                returnArray.push(i);
            }

        } else {
            if (this[i] === searchStr) {
                if (!returnArray) { returnArray = [] }
                returnArray.push(i);
            }
        }
    }
    return returnArray;
}

Array.prototype.findSingle = function (searchStr) {
    for (var i = 0; i < this.length; i++) {
        if (typeof (searchStr) == 'function') {
            if (searchStr(this[i])) {
                return i;
            }

        } else {
            if (this[i] === searchStr) {
                if (!returnArray) { returnArray = [] }
                return i;
            }
        }
    }
    return -1;
}
